//引入request.js

const {request}=require('./request')

module.exports={
  //封装轮播接口
  getBannerApi() {
    return request('banner/list','GET',{type:'index'})
  },
  //封装商品列表接口
  getGoodsListApi() {
   return request('/shop/goods/category/all','GET')
  },
      //获取商品信息
      getGoodsApi() {
        return request('notice/list', 'POST')
    },
  // 好礼直播接口
   getIndexDateApi() {
           return request('site/adPosition/info','GET',{key:'index-live-pic'})
        },
        //首页所有数据
        getGoodsDataApi() {
          return request('shop/goods/list')
      },

      // 搜索页面接口

      getcearchApi(value){
        return request('shop/goods/list','post',{nameLike:value})
      },

              //分类所有数据
              getListDataApi(id) {
                return request('shop/goods/list','post',{categoryId:id})
            },


    //自动登录，注册接口
   autoAuthRegLoginApi(code) {
    return request('/user/wxapp/authorize','POST',{code})
  },

  // 商品详情接口
  getinfoApi(id){
    return request('/shop/goods/detail','get',{id:id})
  },
    //更新用户接口
    updateUserApi(data) {
      return request('/user/modify','POST',data)
    },


    // 登录成功获取我的页面数据
    getmyApi(token){
      return request('/user/detail','get',{token})
    },
    // 加入购物车接口
    getAddcartApi(obj){
      return request('/shopping-cart/add','POST',{goodsId:obj.goodsId,number:obj.number,token:obj.token})
    },

    // 获取购物车数据
    getcartdataApi(token){
      return request('/shopping-cart/info','get',{token})
    },

    // 删除购物车某个商品
    getremovecartApi(obj){
      return request('/shopping-cart/remove','POST',{key:obj.key,token:obj.token})
    },

    // 点击修改购物车选中状态
    getchangeselectApi(obj){
        return request('/shopping-cart/select','POST',{key:obj.key,selected:obj.selected,token:obj.token})
    },

    // 购物车数量加减
    getcartnumApi(obj){
     return request('/shopping-cart/modifyNumber','POST',{key:obj.key,number:obj.number,token:obj.token})
    }
}